package com.sushe.servlet;



import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

/**
 * @author Liu
 * @date 2022/4/4
 * @apiNote
 */
@WebServlet("/allStudentServlet")
public class allStudentServlet extends HttpServlet {

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        response.setCharacterEncoding("utf-8");
        response.setContentType("html/text;charset=utf-8");
        //try {
        //    List<student> studentsList = new StudentDao().selectState(0);
        //    request.setAttribute("studentsList",studentsList);
        //} catch (SQLException e) {
        //    e.printStackTrace();
        //}
        request.getRequestDispatcher("/pages/student.jsp").forward(request,response);
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}
